package com.xiao.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @_PackageName:com.xiao.service
 * @_ClassName:AsnycService
 * @_Description:
 * @_Author：笑老二
 * @_data 2020/12/24 13:13
 */
@Service
public class AsyncService {

    @Async //告诉Spring这是一个异步的方法，相当于写一个@Async，不需要你写多线程
    public void hello(){
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("处理数据中！");

    }
}
